package com.zhijian.wharf.config;

import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;

/**
 * @author HCG
 * @version 1.0
 * @date 2021/7/6
 */
public class Constants {

    /**
     * web端token的key
     */
    public static final String wharf_WEB_TOKEN = "wharfWebToken";

    /**
     * 公众号token的key
     */
    public static final String WEIOT_OA_TOKEN = "wharfOaToken";

    /**
     * 小程序token的key
     */
    public static final String wharf_MP_TOKEN = "wharfMpToken";

    /**
     *
     */
    public static final String wharf_APP_LOCK_KEY = "wharfAppLockKey_wharf777";

    /**
     * APP端token的key
     */
    public static final String WP_APP_TOKEN = "wharfAppToken";

    /**
     * TOKEN访问密钥
     */
    public static final String TOKEN_ACCESS_KEY = "TPyz12zzqYhhzfdX";

    /**
     * TOKEN认证密钥
     */
    public static final String TOKEN_SECRET_KEY = "b&Hky7HSsiancM88ijsUUhjrf652g1fa";

    public static final String MQTT_TOPIC = "biz/wharf/%s/req";

    /**
     * 数字的默认显示值
     */
    public static final String NUMBER_NULL_VALUE = "--";

    /**
     * 用户登陆过期时间,默认2小时
     */
    public static final int LOGIN_EXPIRE_TIME = 60 * 60 * 2;

    /**
     * web端拦截器排除路径
     */
    public static final List<String> WEB_TOKEN_EXCLUDE_PATHS = Arrays.asList("/mp/**",
            "/login",
            "/app/**",
            "/mp/**",
            "/swagger-ui.html/**",
            "/swagger-resources/**",
            "/webjars/**",
            "/upload/file",
            "//b/mqtt/**",
//            "/mqtt/**",
            "/tonglian/**",
            "/device/export/template",
            "/official/account/**",
            "/voice/callback",
            "/third/party/docking/register",
            "/captcha",
            "/v2/**");

    /**
     * 小程序端拦截器排除路径
     */
    public static final List<String> MP_TOKEN_EXCLUDE_PATHS = Arrays.asList("/mp/login",
            "/mp/code/login",
            "/mp/phone/login",
            "/mp/code",
            "/mp/valid",
            "/mp/office/group/list",
            "/mp/register",
            "/app/**");

    /**
     * APP端拦截器排除路径
     */
    public static final List<String> APP_TOKEN_EXCLUDE_PATHS = Arrays.asList("/app/login",
            "/app/code/login",
            "/app/code",
            "/app/valid",
            "/app/office/group/list",
            "/app/register",
            "/mp/**");

    /**
     * 一千
     */
    public static final BigDecimal THOUSAND = new BigDecimal("1000");

    /**
     * xxl-job的app名称
     */
    public static final String XXL_JOB_APP_NAME = "wharf";

    /**
     * xxl-job的执行bean名称
     */
    public static final String XXL_JOB_BEAN_NAME = "deviceSwitch";

    /**
     * 公众号相关
     */
    public static final class OfficialAccount {

        public static final String appId = "wx7562a8b9dc442d4b";

        public static final String appSecret = "b011b8fd0c6cd79248e87f6b8820ef47";

        public static final String token = "wharf";

        public static final String encodingAESKey = "m91m9EKvHPuahE4pfLJQMrKFJtDuKEb9ymuBFIMvsPj";
    }


    /**
     * 缓存常量类
     */
    public static final class Redis {
        /**
         * 后台管理用户登录token信息,如：{userno}:login:token
         */
        public static final String USER_LOGIN_TOKEN = "%s%s:login:token";

        /**
         * 生成token的后台管理用户信息，如：{token}:login:user
         */
        public static final String TOKEN_LOGIN_USER = "%s:login:user";

        /**
         * 公众号的token的key
         */
        public static final String OFFICIAL_ACCOUNTS_TOKEN_KEY = "wharf:official:accounts:access:token";

        /**
         * 验证码 redis key
         */
        public static final String CAPTCHA_CODE_KEY = "captcha_codes:";

    }

}
